<style>
    .forx {
        display: none;
    }
</style>
{{$region:=.region}} {{$regions:=.regions}}
<div class="panel panel-default">
    <div class="panel-body">
        <form class="form-horizontal ajaxform" ajaxSuccess="success" ajaxAlways="always" method="post" action="/web/region/{{.action}}">
            <input type="hidden" name="region_id" value="{{$region.region_id}}">
            <div class="form-group">
                <label class="col-sm-2 control-label"><span class="text-danger"> * </span>区域名称</label>
                <div class="col-sm-4">
                    <input type="text" name="name" class="form-control" value="{{$region.name}}">
                </div>
                <div class="col-md-4">
                    <span class="text-danger"> * 请将汉字限制在15个以内</span>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label"><span class="text-danger"> * </span>上级区域</label>
                <div class="col-sm-4">
                    <select name="parent_id" class="form-control" default="{{$region.parent_id}}">
                            <option value="0">顶级区域</option>
                            {{range $k,$item := $regions}}
                                {{if $region.region_id}}
                                    {{if ne $item.region_id $region.region_id}}
                                    <option value="{{$item.region_id}}">{{$item.name}}</option>
                                    {{end}}
                                {{else}}
                                    <option value="{{$item.region_id}}">{{$item.name}}</option>
                                {{end}}
                                
                            {{end}}
                    </select>
                </div>
                <div class="col-md-4">
                    <span class="text-danger"> * </span>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
                    <button type="submit" class="btn btn-success">保存</button>
                </div>
            </div>
        </form>
    </div>
</div>